# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=iptv
pkgver=138.ae6457b
pkgrel=3
pkgdesc='Search and brute force illegal iptv server.'
groups=('blackarch' 'blackarch-scanner' 'blackarch-cracker')
url='https://github.com/Pinperepette/IPTV'
license=('custom:unknown')
arch=('any')
depends=('python2' 'python2-google' 'python2-psutil' 'python2-clint'
         'python2-colored' 'python2-pyprind' 'python2-pyqt4')
makedepends=('git')
source=("$pkgname::git+https://github.com/Pinperepette/IPTV.git")
sha512sums=('SKIP')

pkgver() {
  cd $pkgname

  echo $(git rev-list --count HEAD).$(git rev-parse --short HEAD)
}

package() {
  cd $pkgname

  install -dm 755 "$pkgdir/usr/bin"
  install -dm 755 "$pkgdir/usr/share/$pkgname"

  install -Dm 644 -t "$pkgdir/usr/share/doc/$pkgname/" README.md
  install -Dm 644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"

  rm README.md LICENSE

  cp -a * "$pkgdir/usr/share/$pkgname"

  mv "$pkgdir/usr/share/$pkgname/$pkgname/"* "$pkgdir/usr/share/$pkgname/"

  rmdir "$pkgdir/usr/share/$pkgname/$pkgname"

  cat > "$pkgdir/usr/bin/iptv-cli" << EOF
#!/bin/sh
cd /usr/share/$pkgname
exec python2 iptv_cli.py "\$@"
EOF

  chmod +x "$pkgdir/usr/bin/iptv-cli"

  cat > "$pkgdir/usr/bin/iptv-gui" << EOF
#!/bin/sh
cd /usr/share/$pkgname
exec python2 iptv_gui.py "\$@"
EOF

  chmod +x "$pkgdir/usr/bin/iptv-gui"
}

